export default {
	namespaced: true,
	state: () => ({
		test: 'abc',
		// 用户信息对象
		userinfo: JSON.parse(uni.getStorageSync('userinfo') || '{}')
	}),
	mutations: {
		updateUserInfo(state, userinfo) {
			state.userinfo = userinfo
			this.commit('m_user/saveUserInfoToStorage')
		},
		deleteUserInfo(state) {
			this.commit('m_user/deleteUserInfoToStorage')
			state.userinfo = {}
		},
		saveUserInfoToStorage(state) {
			uni.setStorageSync('userinfo', JSON.stringify(state.userinfo))
		},
		deleteUserInfoToStorage(state) {
			// uni.setStorageSync('userinfo', '')
			uni.removeStorageSync('userinfo')
		}
	},
	getters: {}
}